<%@ page import="jspSamples.unit7.websiteSample.Login" %>
<%--
  Created by IntelliJ IDEA.
  User: dell
  Date: 2024/11/5
  Time: 19:46
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
</head>
<body>
<%
    /* 接受参数设置为中文*/
    request.setCharacterEncoding("utf-8");
    // 判断是否点击登录
    Login login = new Login();
    String user = request.getParameter("user");
    String pwd = request.getParameter("pwd");
    boolean isok = login.LoginCheck(user, pwd);

    if(isok){
        System.out.println("1111");
        // 返回true 已经在数据库查询到
//            response.sendRedirect("news.jsp");
        out.println("<script>alert('登录成功');location.href='news.jsp'</script>");
    }else{
        out.println("<script>alert('登录失败');location.href='login.jsp'</script>");
    }
%>
</body>
</html>

